/*
 * @Description: 
 * @Author: xuzp4
 * @Date: 2021-06-29 10:42:25
 * @LastEditors: xuzp4
 * @LastEditTime: 2021-06-29 11:09:34
 * @FilePath: \vue_demo\src\util\index.js
 */
const metersToPixelsAtMaxZoom = (meters, latitude) => meters / 0.075 / Math.cos(latitude * Math.PI / 180);

console.log('第一种方法，20zoom',metersToPixelsAtMaxZoom(150,24))


var metersPerPixel = function(latitude, zoomLevel) {
    var earthCircumference = 40075017;
    var latitudeRadians = latitude * (Math.PI/180);
    return earthCircumference * Math.cos(latitudeRadians) / Math.pow(2, zoomLevel + 8);
  };
  
  var pixelValue = function(latitude, meters, zoomLevel) {
    return meters / metersPerPixel(latitude, zoomLevel);
  };

  console.log('第二种方法，19zoom',pixelValue(24,150,18))